{extend name="Layout/edit" /}
{block name="content"}
<!-- form start -->
<form class="form-horizontal" action="{:U('editSave')}" enctype="multipart/form-data" method="post">
    <div class="box-body">
        <div class="form-group">
            <label class="col-sm-2 control-label">文件类别</label>
            <div class="col-sm-10">
                <select name="category_id" class="form-control input-sm" data-url="{:U('FileCategory/getTreeJson')}" data-value="{$data.category_id}"></select>
            </div>
        </div>        
        <div class="form-group">
            <label class="col-sm-2 control-label">文件标题</label>
            <div class="col-sm-10">
                <input type="text" name="title" class="form-control input-sm" placeholder="文件标题" value="{$data['title']}" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">自动命名</label>
            <div class="col-sm-10"><div class="checkbox">
                    <label>
                        <input type="checkbox" name="auto_name" value="Y" checked="checked" /> <span class="text-danger">(使用自动命名可以避免文件重名, 若要保持文件原名请勿勾选此项!)</span>
                    </label>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">封面图片</label>
            <div class="col-sm-10">
                <div class="input-group">
                    <input type="text" name="picture_url" class="form-control input-sm"  placeholder="封面图片"  value="{$data['picture_url']}"/>
                    <span class="input-group-btn">
                        <a href="{:U('Uploader/delete')}" class="btn btn-default btn-sm xsui-btn-singlefile-delete-image" title="删除图片">删除</a>
                        <a href="{:U('Uploader/single_file','name=picture_url')}" class="btn btn-default btn-sm xsui-btn-singlefile-uploader-image" title="选择图片并上传">上传</a>
                    </span>
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">选择文件</label>
            <div class="col-sm-10">
                {xshtml:file name="file_path" class="form-control input-sm" value="data.file_path" /}
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">摘要内容</label>
            <div class="col-sm-10">
                <textarea name="summary" class="form-control input-sm" placeholder="摘要内容" cols="90" rows="3" style="width:99%">{$data.summary}</textarea>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">备注信息</label>
            <div class="col-sm-10">
                <input type="text" name="remark" class="form-control input-sm"  placeholder="备注信息" size="79" value="{$data['remark']}" />
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label">状态</label>
            <div class="col-sm-10">
                {xshtml:radio name="status" data='array("1"=>"启用","0"=>"禁用")' value="data['status']|default='1'" /}
            </div>
        </div>
    </div>
    <input type="hidden" name="id" value="{$data['id']}" />
    <!-- /.box-body -->
    <div class="box-footer">
        <button type="button" class="btn btn-default xsui-btn-close-dialog">取消</button>
        <button type="submit" class="btn btn-primary pull-right">保存</button>
    </div>
    <!-- /.box-footer -->
</form>
{/block}
{block name="script_after"}
<script>
    $('select[name="category_id"]').ajaxcombobox({first:{id:"",text:"选择类别"}});
</script>
{/block}